<?php require_once(dirname(__FILE__) . '/inc/config.inc.php');
IsModelPriv('member'); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>修改会员</title>
    <link href="templates/style/admin.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="templates/js/jquery.min.js"></script>
    <script type="text/javascript" src="templates/js/checkf.func.js"></script>
    <script type="text/javascript" src="templates/js/getarea.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="ui/css/bootstrap.min.css">
    <link rel="stylesheet" href="ui/css/bootstrap-theme.min.css">
    <script src="ui/js/bootstrap.min.js"></script>
    <script language="javascript" type="text/javascript" src="DatePicker/WdatePicker.js"></script>

</head>

<body>
<?php

$row = $dosql->GetOne("SELECT * FROM `#@__user` WHERE `id`=$id");
//address
$address = "";
if ($row['country'] != "") {
    $address .= $row['country'] . "-";
}
if ($row['province'] != "") {
    $address .= $row['province'] . "-";
}
if ($row['city'] != "") {
    $address .= $row['city'];
}


?>
<div class="formHeader"><span class="title">修改会员</span> <a href="javascript:location.reload();" class="reload">刷新</a>
</div>
<form name="form" id="form" method="post" action="member_save.php" onsubmit="return cfm_upmember();">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="formTable">
        <tr>
            <td width="25%" height="40" align="right">用户id：</td>
            <td width="75%"><strong><?php echo $row['id']; ?></strong></td>
        </tr>
        <tr>
            <td width="25%" height="40" align="right">微信昵称：</td>
            <td width="75%"><strong><?php echo $row['nickname']; ?></strong></td>
        </tr>
        <tr>
            <td height="165" align="right">头　像：</td>
            <td><img src="<?php echo $row['headimgurl']; ?>" width="100"/></td>
        </tr>
        <tr>
            <td height="40" align="right">性　别：</td>
            <td><input name="sex" type="radio" value="0" <?php if ($row['sex'] == '1') echo 'checked="checked"'; ?> />
                男&nbsp;
                <input name="sex" type="radio" value="1" <?php if ($row['sex'] == '2') echo 'checked="checked"'; ?> />
                女
            </td>
        </tr>
        <tr>
            <td height="40" align="right">微信资料地址:</td>
            <td><?php echo $address; ?></td>
        </tr>
        <tr class="nb">
            <td colspan="2" height="26">
                <div class="line"></div>
            </td>
        </tr>
        <tr>
            <td height="80" align="right">用户组：</td>
            <td>
                <?php
                $dosql->Execute("SELECT * FROM `#@__usergroup` WHERE 1 ");
                while ($row2 = $dosql->GetArray()) {

                    if ($row['level'] == $row2['id'])
                        $selected = 'checked="checked"';
                    else
                        $selected = '';

                    echo '<label class="checkbox-inline"><input name="level" type="radio"  value="' . $row2['id'] . '" ' . $selected . '>' . $row2['groupname'] . '</label>';

                }
                ?>
                <br/><br/>
                <span class="label label-danger">管理员手机端可以查询所有任务；商务可以派单；工程师接单、完修，只能操作自己任务；职员可以看到所有任务；用户只能报修</span>
            </td>
        </tr>
        <tr>
            <td height="40" align="right">单位：</td>
            <td><input class="form-control w300" type="text" name="school" id="school"
                       value="<?php echo $row['school'] ?>"/></td>
        </tr>
        <tr>
            <td height="40" align="right">姓名：</td>
            <td><input class="form-control w300" type="text" name="truename" id="truename"
                       value="<?php echo $row['truename'] ?>"/></td>
        </tr>
        <tr>
            <td height="40" align="right">手机：</td>
            <td><input class="form-control w300" type="text" name="mobile" id="mobile"
                       value="<?php echo $row['mobile'] ?>"/></td>
        </tr>
        <tr>
            <td height="40" align="right">地址：</td>
            <td><input class="form-control w300" type="text" name="address" id="address"
                       value="<?php echo $row['address'] ?>"/></td>
        </tr>
        <tr>
            <td height="40" align="right">是否可以抢单：</td>
            <td><input name="qiang" type="radio" value="0" <?php if ($row['qiang'] == '0') echo 'checked="checked"'; ?> />
                否&nbsp;
                <input name="qiang" type="radio" value="1" <?php if ($row['qiang'] == '1') echo 'checked="checked"'; ?> />
                是
            </td>
        </tr>
        <tr class="nb">
            <td colspan="2" height="26">
                <div class="line"></div>
            </td>
        </tr>
        <?php
        if ($row['level'] < 5) {
            ?>
            <tr>
                <td height="80" align="right">工作岗位：</td>
                <td>
                    <?php
                    $dosql->Execute(" SELECT * FROM `#@__cascadedata` WHERE   datagroup='zhiwu' ");
                    while ($row22 = $dosql->GetArray()) {

                        if ($row22['datavalue'] == $row['zhiwu'])
                            $selected = 'checked="checked"';
                        else
                            $selected = '';

                        echo '<label class="checkbox-inline"><input name="zhiwu" type="radio"  value="' . $row22['datavalue'] . '" ' . $selected . '>' . $row22['dataname'] . '</label>';

                    }
                    ?>

                    <span class="label label-danger">只用于工资表显示</span>
                </td>
            </tr>
            <tr>
                <td height="40" align="right">入职时间：</td>
                <td><input class="Wdate" name="join_time" id="join_time" type="text"
                           onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd '})"
                           value="<?php echo $row['join_time'] > 0 ? date("Y-m-d", $row['join_time']) : date("Y-m-d") ?>">
                </td>
            </tr>
            <tr>
                <td height="40" align="right">员工生日：</td>
                <td><input class="Wdate" name="birthday" id="join_time" type="text"
                           onclick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd '})"
                           value="<?php echo $row['birthday'] > 0 ? date("Y-m-d", $row['birthday']) : date("Y-m-d") ?>">
                </td>
            </tr>

            <?php
        }
        ?>
        <tr class="nb">
            <td colspan="2" height="26">
                <div class="line"></div>
            </td>
        </tr>


        <tr class="nb">
            <td height="40" align="right">注册时间：</td>
            <td> <?php echo GetDateTime($row['regtime']); ?></td>
        </tr>
        <tr class="nb">
            <td height="40" align="right">最后一次关注微信时间：</td>
            <td> <?php echo GetDateTime($row['subscribe_time']); ?></td>
        </tr>
    </table>
    <div class="formSubBtn">
        <input type="submit" class="btn btn-success" value="提交"/>
        <input type="button" class="btn btn-info" value="返回" onclick="history.go(-1);"/>
        <input type="hidden" name="action" id="action" value="update"/>
        <input type="hidden" name="id" id="id" value="<?php echo $row['id']; ?>"/>
    </div>
</form>
</body>
</html>